import type { RouteRecordRaw } from "vue-router";

export declare type ScrollPositionCoordinates = {
  behavior?: ScrollOptions["behavior"];
  left?: number;
  top?: number;
};
export declare type Awaitable<T> = T | Promise<T>;

export declare interface ScrollPositionElement extends ScrollToOptions {
  el: string | Element;
}

export declare type ScrollPosition =
  | ScrollPositionCoordinates
  | ScrollPositionElement;
export declare type _ScrollPositionNormalized = {
  behavior?: ScrollOptions["behavior"];
  left: number;
  top: number;
};

// 扩展路由元信息类型
export interface RouteMeta {
  /**
   * 路由标题，用于面包屑、页面标题等
   */
  title?: string;
  /**
   * 是否在侧边栏隐藏
   * @default false
   */
  hidden?: boolean;
  /**
   * 路由图标
   */
  icon?: string;
  /**
   * 是否缓存路由组件
   * @default false
   */
  keepAlive?: boolean;
  /**
   * 路由权限要求
   * 为空表示不需要权限
   */
  roles?: string[];
  /**
   * 路由排序，用于侧边栏排序
   */
  order?: number;

  /**
   * 是否是外部链接
   */
  isExternal?: boolean;
}

// 扩展路由记录类型
export interface AppRouteRecordRaw
  extends Omit<RouteRecordRaw, "meta" | "children"> {
  meta?: RouteMeta;
  children?: AppRouteRecordRaw[];
  // 可选的重定向路径
  redirect?: string;
}
